//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef WATERTEK_CPLD_H
#define WATERTEK_CPLD_H

#include "SMA_types.h"

/**********************************************************************
 * CPLD interrupt mask
 *********************************************************************/
#define ETH_WAKEUP_MASK    _BIT(7)
#define ETH_INT_MASK       _BIT(6)
#define ETH_IOWAIT_MASK    _BIT(5)
#define RI2_INT_MASK       _BIT(4)
#define USB_INT1_MASK      _BIT(3)
#define USB_INT2_MASK      _BIT(2)
#define H_SUSPEND_MASK     _BIT(1)
#define D_SUSPEND_MASK     _BIT(0)
#define ALL_INT_MASK        0xff

/**********************************************************************
 * CPLD interrupt
 *********************************************************************/
#define ETH_WAKEUP    _BIT(7)
#define ETH_INT       _BIT(6)
#define ETH_IOWAIT    _BIT(5)
#define RI2_INT       _BIT(4)
#define USB_INT1      _BIT(3)
#define USB_INT2      _BIT(2)
#define H_SUSPEND     _BIT(1)
#define D_SUSPEND     _BIT(0)

/**********************************************************************
 * CPLD power control io
 *********************************************************************/
#define USB_PWR      _BIT(7)
#define ETH_PWR      _BIT(6)
#define RS232_PWR    _BIT(5)
#define IRDA_PWR     _BIT(4)
#define LCD_PWR      _BIT(3)
#define LIGHT_PWR    _BIT(2)
#define AUDIO_PWR    _BIT(1)
#define CF_PWR       _BIT(0)

/**********************************************************************
 * CPLD extern io
 *********************************************************************/
#define  ETH_RST      _BIT(2)
#define  H_WAKEUP     _BIT(1)
#define  D_WAKEUP     _BIT(0)

/**********************************************************************
 * CPLD structure
 *********************************************************************/
typedef struct
{
    UNS_8 keyState;
    UNS_8 noUse11;
    UNS_8 noUse12;
    UNS_8 noUse13;

    UNS_8 intState;
    UNS_8 noUse21;
    UNS_8 noUse22;
    UNS_8 noUse23;

    UNS_8 intMask;
    UNS_8 noUse31;
    UNS_8 noUse32;
    UNS_8 noUse33;

    UNS_8 pwrIO;
    UNS_8 noUse41;
    UNS_8 noUse42;
    UNS_8 noUse43;

    UNS_8 extIO;
} CPLDREGS;

#endif /* WATERTEK_CPLD_H */
